package com.amos.base.util;

import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.Collection;

/**
 * @author Amos
 * @ClassName StringU
 * @Description TODO
 * @Date 2018/12/22 23:38
 * @VERSION 1.0
 **/
public class NullUtils {
    /**
     * 判断是否为空
     * 判断包括集合
     * @param obj
     * @return
     */
    public static boolean isEmpty(Object obj){
        if (obj instanceof Collection){
            return CollectionUtils.isEmpty((Collection)obj);
        }else {
            return StringUtils.isEmpty(obj);
        }
    }
    /**
     * 判断不为空
     * 判断包括集合
     * @param obj
     * @return
     */
    public static boolean isNotEmpty(Object obj){
        return !isEmpty(obj);
    }
}
